<template>
<div id="root">
  <h2>时间</h2>
  <h3>当前时间戳: {{time}}</h3>
  <h3>转换后时间: {{time | timeFormater()}}</h3>
  <h3>转换后时间: {{time | timeFormater('YYYY-MM-DD HH:mm:ss')}}</h3>
  <h3>截取年月日: {{time | timeFormater() | mySlice}}</h3>
</div>
</template>

<script>

export default {
  name: "GuoLvQi",
  data() {
    return {
      time:1626750147900,
    }
  },
  //局部过滤器
  filters: {
    timeFormater(value, str="YYYY年MM月DD日 HH:mm:ss"){
      return dayjs(value).format(str)
    }
  }
}
</script>

<style scoped>

</style>
